package com.lgt_enterprise_android.base;

import android.content.Context;
import android.widget.BaseAdapter;

import com.alibaba.fastjson.JSONArray;

public abstract class MyBaseAdapter extends BaseAdapter {

    protected JSONArray mArray;
    protected Context mContext;

    public MyBaseAdapter(Context _mContext,JSONArray _mArray){
        this.mArray=_mArray;
        this.mContext=_mContext;
    }

    public void setData(JSONArray array){
        mArray=array;
    }

    public void addData(JSONArray _array){
        for(int i=0,m=_array.size();i<m;i++){
            mArray.add(_array.getJSONObject(i));
        }
    }


    @Override
    public int getCount() {
        if(mArray==null){
            return 0;
        }
        return mArray.size();
    }

    @Override
    public Object getItem(int i) {
        return mArray.getJSONObject(i);
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }


}
